package cn.cdyx.ydhl.webservice;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.junit.Test;
import javax.xml.namespace.QName;

public class TestWebService {
    @Test
    public void test() throws Exception {
        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        // ClassLoader scl = ClassLoader.getSystemClassLoader();
        Client client = dcf.createClient("http://localhost:9993/webService/TestService?wsdl");
        /*如果带了命名空间那么方法名需要使用QName获取 ，第一个参数是命名空间，第二个参数是方法名
        QName method = new QName(namespace,method);*/
        Object[] objects = client.invoke("sendTest", "asd");
        System.out.println(objects[0].toString());

    }
}
